<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.util.Info"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.model.Sysuser"%>
<%@page import="com.model.Notice"%>
<%@page import="com.model.Familyda"%>
<%@page import="com.model.Familycy"%>
<%@page import="com.model.Tjreport"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理页面</title>
<!-- 调用CSS，JS -->
<link href="/wearablehealthymonitorsys/admin/images/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family: "宋体";
	font-size: 12px;
	color: #333333;
	background-color: ;
}
.STYLE1 {
	color: #333333;
	font-size: x-large;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<script language="javascript">
function window.onload() { 

if(top.location != self.location){ 

var a = window.parent.document.getElementsByTagName('iframe'); 

for (var i=0; i<a.length; i++){ 

if (a[i].name == self.name) {a[i].height = document.body.scrollHeight+320; return;}}} 
} 
</script>
<script language=javascript>
function show(no)
{
for(var i=1;i<20;i++)
{
var a = document.getElementById(no+"@"+i);
if(a==null)
{
continue;
}
if(a.style.display=="")
{
a.style.display="none";
}else{
a.style.display="";
}
}

}
</script>
<script type="text/javascript">
function showzhi(inn)
{
var a = document.getElementById("loca");
a.innerHTML=inn;
}
function change(no)
{
var c = document.getElementById("c");
c.innerHTML=no;
}
</script>

</head>
<body>
  <% 
  CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");
  Sysuser user = (Sysuser)session.getAttribute("user"); 
  %>

  
	<form id="form1" name="form1" method="post" action="familycygl.jsp?f=f">

<br />


			<table width="100%">
				<tr>
					<td width="20%" valign="top">
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">
						<tr>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">报告编号</td>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">体检日期</td>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF"></td>
                            </tr>
					<%String cyid = request.getParameter("cyid");
					String bgno = request.getParameter("bgno")==null?"":request.getParameter("bgno");
					String did = request.getParameter("did")==null?"":request.getParameter("did");
					if(!did.equals("")){
						dao.delete(did,"Tjreport");
					}
					ArrayList<Tjreport> tjbglist = (ArrayList<Tjreport>)dao.findByHql("from Tjreport where cyid='"+cyid+"' order by savetime desc");
					for(Tjreport tjbg:tjbglist){
					%>
                          <tr>
                            <td height="26" align="center" bgcolor="#FFFFFF"><a href="report.jsp?bgno=<%=tjbg.getBgno() %>&cyid=<%=cyid %>"><%=tjbg.getBgno() %></a></td>
                            <td height="26" align="center" bgcolor="#FFFFFF"><%=tjbg.getSavetime().substring(0,10) %></td>
                            <td height="26" align="center" bgcolor="#FFFFFF">
                            <a href="tjreportedit.jsp?cyid=<%=cyid %>&id=<%=tjbg.getId() %>">改</a>|
                            <a href="report.jsp?cyid=<%=cyid %>&did=<%=tjbg.getId() %>">删</a></td>
                          </tr>
                        <%} %> 
						</table>  
						</td>
						<td width="80%" valign="top">
						<%
						if(!bgno.equals("")){
						Familycy cy = (Familycy)dao.findById(cyid,"Familycy");
						Tjreport bg = (Tjreport)dao.findByHql("from Tjreport where bgno='"+bgno+"'").get(0);
						%>
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">   
						<th colspan="4" height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">体检报告</th>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">姓名</td>
							<td align="center" bgcolor="#FFFFFF"><%=cy.getTname() %></td>
							<td align="center" bgcolor="#FFFFFF">性别</td>
							<td align="center" bgcolor="#FFFFFF"><%=cy.getSex() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">年龄</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getAge() %></td>
							<td align="center" bgcolor="#FFFFFF">身高</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getSg() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">体重</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getTz() %><%if(Double.valueOf(bg.getTz())>=90){ %><font color="red">[过重]</font> <%} %></td>
							<td align="center" bgcolor="#FFFFFF">视力</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getSl() %><%if(Double.valueOf(bg.getSl())<0.8){ %><font color="red">[注重用眼]</font><%} %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">听力</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getTl() %></td>
							<td align="center" bgcolor="#FFFFFF">血压</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getXy() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">呼吸系统是否正常</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getHxnote() %></td>
							<td align="center" bgcolor="#FFFFFF">有无先天异常病</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getYcbnote() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">消化系统是否正常</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getXhxtnote() %></td>
							<td align="center" bgcolor="#FFFFFF">是否贫血</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getIspx() %></td>
						</tr>
						<tr>
							<td align="center" bgcolor="#FFFFFF">其他</td>
							<td bgcolor="#FFFFFF" colspan="3"><%=bg.getOthernote() %></td>
						</tr>
						 </table>
						 <%} %>
			</td>
		</tr>
	</table>
	
	<table>
		<tr>
			<td width="20%"></td>
			<td>
				<script language="JavaScript" src="/wearablehealthymonitorsys/admin/FusionCharts.js"></script>
                         	<input type="hidden" id="res" name="res"/>
                            		<div id="chartdiv" align="center"> </div>
								      <script type="text/javascript">
								      
										var xml = document.getElementById("res").value;
								      function test()
									   { 
										refrash(); 
									    setTimeout(test ,2000);
									   }
									   	setTimeout(test ,2000);
										 
									</script> 
			
			</td>
		</tr>
	</table>
	
	
</form>   


<script type="text/javascript">
    //定义一个变量用于存放XMLHttpRequest对象
	var xmlHttp; 
	
	//该函数用于创建一个XMLHttpRequest对象
	function createXMLHttpRequest() {
		if (window.ActiveXObject) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		else if (window.XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
		}
	}
		//这是一个启动AJAX异步通信的方法
	function refrash()
	{
		
		//创建一个XMLHttpRequest对象
		createXMLHttpRequest();
		//将状态触发器绑定到一个函数
		

		xmlHttp.onreadystatechange = processor;
		//通过GET方法向指定的URL建立服务器的调用
		
		xmlHttp.open("GET", "searchTz.action?cyid=<%=cyid%>");
		xmlHttp.setRequestHeader("Cache-Control","no-cache"); 
		xmlHttp.setRequestHeader("If-Modified-Since","0"); 
		//发送请求
		xmlHttp.send(null);
		

	}
	function processor () 
	{
		//定义一个变量用于存放从服务器返回的响应结果
		var responseContext;
		if(xmlHttp.readyState == 4) 
		{ //如果响应完成
		
			if(xmlHttp.status == 200) 
			{//如果返回成功
				//取出服务器的响应内容
				responseContext = xmlHttp.responseText;
				//setTimeout(test ,2000);
				 var chart = new FusionCharts("/wearablehealthymonitorsys/admin/FCF_MSLine.swf", "ChartId", "1000", "330");
				 chart.setDataXML(responseContext);	
				 chart.render("chartdiv");
			}
		}
	}
	
	function InitAjax() 
{ 
　var ajax=false; 
　try { 
　　ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
　} catch (e) { 
　　try { 
　　　ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
　　} catch (E) { 
　　　ajax = false; 
　　} 
　} 
　if (!ajax && typeof XMLHttpRequest!='undefined') { 
　　ajax = new XMLHttpRequest(); 
　} 
　return ajax; 
} 
    </script>                 
</body>
</html>
